<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pageConf['title']?></title>
<script type="text/javascript" src="Template/jquery/jquery-1.7.2.min.js"></script>
<!--js文件-->
<?php $js = explode('|', $pageConf['js']);
	foreach ($js as $k => $j) { ?>
	<script src="Template/javascript/<?php echo $j?>.js" type="text/javascript"></script>
<?php } ?>
<!--css文件-->
<?php $css = explode('|', $pageConf['css']);
	foreach ($css as $k => $c) { ?>
	<link rel="stylesheet" href="Template/css/<?php echo $c?>.css">
<?php } ?>

<!--异步修改购物车商品当数量里边的值发生改变的时候发送异步-->
<script type="text/javascript">
	$(function(){
		$("input[name='shul']").change(function(){
			var shuliang = $(this).val();//商品数量			
			var sid = $(this).siblings('.hiddenSid').val();//商品sid	
			var total = $(this).siblings('.danjia').val();//商品单价
			$(this).parents('div').siblings('.search_shopping_erji2').find('em i').html(total*shuliang);
				$.ajax({
					type:"post",
					url:"{|U:'Index/Index/edit'}",
					data:{shuliang : shuliang,sid:sid},//请求数据
					dataType:'json',//数据类型
					success:function(phpData){
							$('.search_shopping_paymoney span').html(phpData);
							$('.jiesuan span em').html(phpData);
					}
				});	

		});					
	})
</script>
<!--异步修改购物车商品结束-->
<script type="text/javascript">
	$(function(){		
		$('a.add').click(function(){
			var sid = $(this).siblings('.hiddenSid').val();//商品sid	
			var i =$(this).siblings('.shul').val();//现在的数量i
			i++;//没单击一次i自增1
			if(i<100){
				$(this).siblings('.shul').val(i);//将自增之后的值赋值回去
				var shuliang = $(this).siblings('.shul').val();//点击增加以后再获得当前val值
				var total = $(this).siblings('.danjia').val();//商品单价
				$(this).parents('div').siblings('.search_shopping_erji2').find('em i').html(total*shuliang);//再把计算后的商品总价赋值			
					$.ajax({
						type:"post",
						url:"{|U:'Index/Index/edit'}",
						data:{shuliang : shuliang,sid:sid},//请求数据
						dataType:'json',//数据类型
						success:function(phpData){
							$('.search_shopping_paymoney span').html(phpData);
							$('.jiesuan span em').html(phpData);
						}
					});	
			}				
		})
		//点击减号单机事件
		$('a.mul').click(function(){
			var sid = $(this).siblings('.hiddenSid').val();//商品sid	
			var i =$(this).siblings('.shul').val();//现在的数量i	
			i--;
			if(i>0){
				$(this).siblings('.shul').val(i);//将自增之后的值赋值回去
				var shuliang = $(this).siblings('.shul').val();//点击减号以后再获得当前val值
				var total = $(this).siblings('.danjia').val();//商品单价
				$(this).parents('div').siblings('.search_shopping_erji2').find('em i').html(total*shuliang);//再把计算后的商品总价赋值
					$.ajax({
						type:"post",
						url:"{|U:'Index/Index/edit'}",
						data:{shuliang : shuliang,sid:sid},//请求数据
						dataType:'json',//数据类型
						success:function(phpData){
							$('.search_shopping_paymoney span').html(phpData);
							$('.jiesuan span em').html(phpData);
						}
					});	
			}
			
	    })
	})
</script>
<!--点击加减异步修改-->
<!--异步删除一个商品-->
<script type="text/javascript">
	$(function(){
		$('.delOneCart').click(function(){
			var sid = $(this).parents('p').siblings('.search_shopping_erji3').find('.hiddenSid').val();//商品sid	
			var shuliang = $(this).parents('p').siblings('.search_shopping_erji3').find('.shul').val();//商品数量
			var xiaoji = $(this).parents('p').siblings('.search_shopping_erji2').find('em i').html();//商品小计
			$(this).parents('li').remove();//把当前li移除
			$.ajax({
						type:"post",
						url:"{|U:'Index/Index/delOneCart'}",
						data:{shuliang : shuliang,sid:sid,xiaoji:xiaoji},//请求数据
						dataType:'json',//数据类型
						success:function(phpData){
							$('.search_shopping_paymoney span').html(phpData);
							$('.jiesuan span em').html(phpData);
						}
			});
			$.ajax({
						type:"post",
						url:"{|U:'Index/Index/delOneCart'}",
						data:{shuliang : shuliang,sid:sid,xiaoji:xiaoji},//请求数据
						dataType:'json',//数据类型
						success:function(phpData){
							
						}
			});	
		})
	})
</script>
<!--异步删除一个商品结束-->
</head>
<body>
	<!--顶部导航-->
	<div id="top_nav">
		<div class="top_ad_center">
			<div class="num1">
				<a href="<?php echo U('Index/index')?>">时尚商城</a>
			</div>
			<div class="num1 num2">
				<a href="javascript:;">手机优购</a>
			</div>
			<!--右侧-->
			<div class="top_ad_right">
				<?php if(isset($_SESSION['username'])){?>
                
					<div class="top_ad_right1">
						<span>您好，<?php echo substr($_SESSION['username'],0,-7)?></span>
						<a href="<?php echo U('Public/out')?>" style="color: #666666;" class="out">退出登录</a>
					</div>
				<?php }else{?>
					<div class="top_ad_right1">
						<a href="<?php echo U('Public/login')?>">登陆</a>
						<a href="<?php echo U('Public/reg')?>">注册</a>
					</div>
				
               <?php }?>
				<div class="top_ad_right2">
					<?php if(isset($_SESSION['username'])){?>
                
						<a href="<?php echo U('MineYG/index')?>">我的优购</a>
					<?php }else{?>
						<a href="<?php echo U('Public/login')?>">我的优购</a>
					
               <?php }?>					
				</div>
				<div class="top_ad_right2">
					<?php if(isset($_SESSION['username'])){?>
                
						<a href="<?php echo U('MineYG/order')?>">我的订单</a>
					<?php }else{?>
						<a href="<?php echo U('Public/login')?>">我的订单</a>
					
               <?php }?>
				</div>

			</div>
			<!--右侧结束-->
		</div>		
	</div>
	<!--顶部导航结束-->
	<!--搜索区域-->
	<div id="search">
		<!--搜索大区域-->
		<div class="search_center">
			<!--优购logo-->
			<div class="logo">
				<a href="<?php echo U('Index/index')?>"><img src="TEMPLATE/images/logo.jpg"/></a>
			</div>
			<!--优购logo结束-->
			<!--form搜索区域-->
			<form action="" method="post">
				<div class="form_left"></div>
				<div class="input_search">
					<input type="text" name="keyword" id="" value=""/>
				</div>
				<div class="form_left"></div>
				<div class="search_btn">
				</div>
			</form>
			<!--form区域结束-->
			<!--热门搜索-->
			<div class="search_hot">
				<?php foreach ($data as $k=>$v){?>
				|<a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>">&nbsp;<?php echo $v['cname']?></a>
				<?php }?>
			</div>
			<!--热门搜索区域结束-->
			<!--购物车-->
			<div class="search_shopping">
				<a href="<?php echo U('MyCart/index')?>">
					<div class="search_shopping_logo"></div>
					<div class="search_shopping_paymoney">
						购物车(
						<?php if(isset($_SESSION['cart'])){?>
                
						<span><?php echo $cart?></span>
						<?php }else{?>
						<span>0</span>
						
               <?php }?>
						)件													
					</div>
					<div class="search_shopping_sanjiao"></div>																
				</a>
				
				<?php if(isset($_SESSION['cart'])){?>
                
					<?php
						$goods = $_SESSION['cart']['goods'];
					?>
					<div class="search_shopping_erji">
						<ul>
							<?php foreach ($goods as $k=>$v){?>
							<li>
								<div class="img">
									<a href=""><img src="<?php echo $v['options']['pic']?>" alt="" /></a>
								</div>
								<div class="search_shopping_erji1">
									<p class="search_shopping_erji11"><a href=""><?php echo $v['name']?></a></p>
									<p class="search_shopping_erji12">颜色：<em><?php echo $v['options']['color']?></em>尺码：<em><?php echo $v['options']['size']?></em></p>
								</div>
								<div class="search_shopping_erji2"><em>¥<i><?php echo $v['total']?></i></em></div>
								<div class="search_shopping_erji3">
									<input type="hidden" name="danjia" id="" value="<?php echo $v['price']?>" class="danjia"/>
									<a href="javascript:;" class="mul">-</a>
									<input type="text" name="shul" id="" value="<?php echo $v['num']?>" class="shul"/>
									<a href="javascript:;" class="add">+</a>
									<input type="hidden" name="hiddenSid" id="" value="<?php echo $k?>" class="hiddenSid"/>
								</div>	
								<p class="search_shopping_erji4"><a href="javascript:;" class="delOneCart">删除</a></p>
							</li>
							<?php }?>
						</ul>
						<div class="jiesuan">
							<span>共 <em><?php echo $cart?></em> 件商品</span>
							<a href="<?php echo U('MyCart/index')?>">去购物车结算</a>
						</div>						
					</div>
				<?php }else{?>
					<div class="search_shopping_erji" style="height: 50px;text-align: center;">
						<p style="margin-top: 15px;color: #A9A9A9;">您的购物车中还没有任何商品</p>
					</div>
				
               <?php }?>
			</div>
			<!--购物车结束-->
		</div>	
		<!--搜索大区域结束-->
	</div>
	<!--搜索区域结束-->
	<!--全部商品分类区域导航部分开始-->
	<div id="all_nav">
		<div class="all_nav_center">
			<div class="all_nav_center1">
				<h2></h2>
				<div class="all_main_center_left">
				<ul>
					<li>
						<div class="all_main_center_left1">
							<i class="a"></i>
							<a href="javascript:;" class="all_main_center_left11">本周精彩</a>
						</div>
						<div class="all_main_center_left2">
							<a href="javascript:;" class="all_main_center_left11">MLB4.5折封顶</a>
							<a href="javascript:;" class="all_main_center_left11">太阳镜99起</a>
						</div>
						<div class="all_main_center_left3">
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji1.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji2.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji3.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji4.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji5.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji6.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji7.jpg"/></a>
							<a href="" class="all_main_center_left3a"><img src="<?php echo TEMPLATE?>/images/erji8.jpg"/></a>
						</div>
					</li>
					<?php foreach ($data as $k=>$v){?>
					<li>
						<div class="all_main_center_left1">
							<i class="b<?php echo $k?>"></i>
							<a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>" class="all_main_center_left11"><?php echo $v['cname']?></a>
						</div>
						<div class="all_main_center_left2">
							        <?php
        if (empty($v['_data'])) 
        {
            echo '';
        } 
        else 
        {
            //初始化
            $first=$last=$total=$index=$id=0;
            $hd['list']['vv']['first']=&$first;
            $hd['list']['vv']['last']=&$last;
            $hd['list']['vv']['total']=&$total;
            $hd['list']['vv']['index']=&$index;
            foreach ($v['_data'] as $vv) 
            {
                //开始值
                if ($id<0)
                {
                    $id++;
                    continue;
                }
                //步长
                if($id%1!=0)
                {   
                    $id++;
                    continue;
                }
                //显示条数
                if($index>=4)
                {
                    break;
                }
                //第几个值
                $index+=1;
                //第1个值
                $first=($id == 0);
                //最后一个值
                $last=($index == 4);
                //增加数
                $id+=1;
            ?>
								<a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>" class="all_main_center_left11"><?php echo $vv['cname']?></a>
							<?php }
            //总数
            $total=$index;
        }?>
						</div>
						<!--二级导航部分隐藏div-->
						<div class="all_main_center_left3">
							        <?php
        if (empty($v['_data'])) 
        {
            echo '';
        } 
        else 
        {
            //初始化
            $first=$last=$total=$index=$id=0;
            $hd['list']['vv']['first']=&$first;
            $hd['list']['vv']['last']=&$last;
            $hd['list']['vv']['total']=&$total;
            $hd['list']['vv']['index']=&$index;
            foreach ($v['_data'] as $vv) 
            {
                //开始值
                if ($id<4)
                {
                    $id++;
                    continue;
                }
                //步长
                if($id%1!=0)
                {   
                    $id++;
                    continue;
                }
                //显示条数
                if($index>=4)
                {
                    break;
                }
                //第几个值
                $index+=1;
                //第1个值
                $first=($id == 4);
                //最后一个值
                $last=($index == 4);
                //增加数
                $id+=1;
            ?>
							<p class="all_main_center_left31"><a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>"><?php echo $vv['cname']?></a></p>						
							<p class="all_main_center_left32">
								<?php foreach ($vv['_data'] as $kkk=>$vvv){?>
									<a href="<?php echo U('List/index',array('cid'=>$v['cid']))?>" class="all_main_center_left321"><?php echo $vvv['cname']?></a>
								<?php }?>
							</p>
							<?php }
            //总数
            $total=$index;
        }?>
						</div>
						<!--二级导航部分隐藏div结束-->
					</li>
					<?php }?>							
					<li>
						<div class="all_main_center_left1">
							<i class="a"></i>
							<a href="javascript:;" class="all_main_center_left11">品牌大全</a>
						</div>
						<div class="all_main_center_left2">
							<a href="javascript:;" class="all_main_center_left11">MLB4.5折封顶</a>
							<a href="javascript:;" class="all_main_center_left11">太阳镜99起</a>
						</div>
					</li>				
				</ul>
				</div>
			</div>
			
				
			
			<div class="all_nav_right">
				<ul>
					<?php foreach ($data as $k=>$v){?>
						<li><a href="<?php echo U('Home/List/index',array('cid'=>$v['cid']))?>"><?php echo $v['ctitle']?></a></li>
					<?php }?>

				</ul>
			</div>	
			
		</div>
	</div>
	<!--全部商品部分导航结束-->

	<!--下边大区域全部-->
	<div class="list_bottom">
		<!--面包屑-->
		<div class="list_bottom_fr">
			<span class="tit">您已选择：</span>
			<a href="<?php echo U('Home/Index/index')?>" title="全部分类">全部分类</a>
			<?php foreach ($fatherData as $k=>$v){?>
				<span class="fenge">></span>
				<a href="<?php echo U('Home/List/index',array('cid'=>$v['cid']))?>" title="<?php echo $v['cname']?>"><?php echo $v['cname']?></a>
			<?php }?>
		</div>
		<!--面包屑结束-->
		<div class="list_bottom_all">
			<!--左侧部分第一部分-->
			<div class="list_bottom_all_left">
				<div class="list_bottom_all_left1">
					<p><a href="<?php echo U('Home/List/index')?>">全部分类</a></p>
					<?php foreach ($allCateData as $k=>$v){?>
					<div class="list_bottom_all_left11"><a href="<?php echo U('Home/List/index',array('cid'=>$v['cid']))?>"><?php echo $v['cname']?></a></div>
						<?php foreach ($v['_data'] as $kk=>$vv){?>
						
 							<div class="list_bottom_all_left12">
								<p <?php if($vv['cid']==$_GET['cid']){?>
                class="hover"
               <?php }?> ><a href="<?php echo U('Home/List/index',array('cid'=>$vv['cid']))?>"><?php echo $vv['cname']?></a></p>
								<ul>
									<?php foreach ($vv['_data'] as $kkk=>$vvv){?>
										<li <?php if($vvv['cid']==$_GET['cid']){?>
                class="hover"
               <?php }?> ><a href="<?php echo U('Home/List/index',array('cid'=>$vvv['cid']))?>"><?php echo $vvv['cname']?></a></li>
									<?php }?>
								</ul>
							</div>
						<?php }?>
					<?php }?>
			</div>
				<!--左侧第一部分结束-->

				<!--左侧第二部分结束-->
			</div>
			<!--左侧部分结束-->
			<!--右侧部分-->
			<div class="list_bottom_all_right">
				<!--右侧第一部分-->
				<div class="list_bottom_all_right1">
					<?php if(isset($tempFinalAttr)){?>
                
					<?php foreach ($tempFinalAttr as $k=>$v){?>
						<dl>
							<dt><?php echo $v['name']?></dt>
							<dd>
								<?php	
									//赋值给临时变量,为了不破坏$param
									$temp = $param;
									//为了不限做准备
									$temp[$k] = 0;
								?>
								<ul>
									<li <?php if($param[$k]==0){?>
                class="hover"
               <?php }?> ><a href="<?php echo U('Home/List/index',array('cid'=>$_GET['cid'],'param'=>implode('_',$temp)))?>">不限</a></li>	
									<?php foreach ($v['value'] as $kk=>$vv){?>
									<?php $temp[$k]=$vv['gaid'] ?>
										<li <?php if($param[$k]==$vv['gaid']){?>
                class="hover"
               <?php }?>><a href="<?php echo U('Home/List/index',array('cid'=>$_GET['cid'],'param'=>implode('_',$temp)))?>" class="hover"><?php echo $vv['gavalue']?></a></li>	
									<?php }?>
								</ul>
							</dd>
						</dl>
					<?php }?>
					
               <?php }?>
				</div>
				<!--右侧第二部分-->
				<!--右侧四三部分-->
				<ul class="list_bottom_all_right3">
					<?php if(isset($goodsData)){?>
                
						<?php foreach ($goodsData as $k=>$v){?>
							<li>
								<div class="sale_bottom_right_img">
									<a href="<?php echo U('Home/Content/index',array('gid'=>$v['gid']))?>"><img src="<?php echo __ROOT__?>/<?php echo $v['pic']?>"/></a>
								</div>
								<div class="sale_bottom_right_se">
									<a href="<?php echo U('Home/Content/index',array('gid'=>$v['gid']))?>">限时抢<strong>￥<?php echo $v['shopprice']?></strong></a>
								</div>
								<div class="sale_bottom_right_th">
									<a href="<?php echo U('Home/Content/index',array('gid'=>$v['gid']))?>"><span><?php echo $v['gname']?></span></a>															
									<p><span>￥</span><i><?php echo $v['shopprice']?></i><del>￥<?php echo $v['marketprice']?></del>
										<!--<span class="sale_bottom_right_thspan"><i>5.7</i><span>折</span></span>-->
									</p>																						
								</div>
							</li>
						<?php }?>
					<?php }else{?>
						<div class="nogoods">
							<div class="nogoods_center">
								<p>很抱歉，没有找到符合您要求的商品 </p>
								<span>非常抱歉给您这样的结果，我们会努力扩展商品和改善搜索服务！</span>
							</div>
						</div>
					
               <?php }?>
				</ul>
				<!--右侧第三部分结束-->

			</div>
			<!--右侧部分结束-->
		</div>
	</div>
	
	<!--下边大区域全部结束-->

	<!--footer区域开始-->
	<div id="footer_one">
		<div class="footer_one_center">
			<div class="footer_one_center_header">
				<ul>
					<li>
						<i></i>
						<a href=""><em>100%</em>正品保证</a>
					</li>
				</ul>
				<ul>
					<li>
						<i class="footer_i1"></i>
						<a href=""><em>10天</em>退换货</a>
					</li>
				</ul>
				<ul>
					<li>
						<i class="footer_i2"></i>
						<a href=""><em>10天调价</em>补差额</a>
					</li>
				</ul>
				<ul>
					<li>
						<i class="footer_i3"></i>
						<a href=""><em>7×24</em>在线客服</a>
					</li>
				</ul>
			</div>
			<div class="footer_one_center_bottom">
				<dl>
					<dt>新手帮助</dt>
					<dd><a href="">交易条款协议</a></dd>
					<dd><a href="">注册新用户</a></dd>
					<dd><a href="">会员积分详情</a></dd>
				</dl>
				<dl>
					<dt>购物指南</dt>
					<dd><a href="">订购流程</a></dd>
					<dd><a href="">验货与签收</a></dd>
					<dd><a href="">订单配送查询</a></dd>
				</dl>
				<dl>
					<dt>支付/配送</dt>
					<dd><a href="">支付方式</a></dd>
					<dd><a href="">配送方式</a></dd>
					<dd><a href="">配送时间及运费</a></dd>
				</dl>
				<dl>
					<dt>售后服务</dt>
					<dd><a href="">退换货政策</a></dd>
					<dd><a href="">退款说明</a></dd>
					<dd><a href="">发票制度</a></dd>
				</dl>
				<dl>
					<dt>会员服务</dt>
					<dd><a href="">找回密码</a></dd>
					<dd><a href="">联系我们</a></dd>
				</dl>
				<dl class="fot">
					<dt>优购服务</dt>
					<dd><a href="">
						<span></span>
						<a href="">在线咨询</a>
					</dd>
					<dd>Email：<em>service@yougou.com</em></dd>
				</dl>
			</div>
		</div>
		
	</div>
	<div id="footer_two">
		<div class="footer_two_center">
			<div class="footer_two_center_img">
				<a href="" alt="优购时尚商城" title="优购时尚商城"><img src="<?php echo TEMPLATE?>/images/footer_two_center_img.png"/></a>
			</div>
			<div class="footer_two_center_right">
					<p>
						<a href="">关于优购</a> |
						<a href="">品牌招商</a> |
						<a href="">集团采纳</a> |
						<a href="">招贤纳士</a> |
						<a href="">手机优购</a> |
						<a href="">联系我们</a> |
						<a href="">品牌大全</a> |
						<a href="">网站地图</a> |
						<a href="">销售排行</a> |
						<a href="">优购资讯</a> |
						<a href="">网站联盟</a> |
						<a href="">友情链接</a>
					</p>
					<p>Copyright © 2011-2015 Yougou Technology Co., Ltd. <a href="">粤ICP备09070608号-4</a> 增值电信业务经营许可证：<a href="">粤 B2-20090203</a> 深公网安备：4403101910665</p>
					<div class="footer_two_center_right3">
						<a href=""><img src="<?php echo TEMPLATE?>/images/footer_two_center_right35.png"/></a>
						<a href=""><img src="<?php echo TEMPLATE?>/images/footer_two_center_right34.png"/></a>
						<a href=""><img src="<?php echo TEMPLATE?>/images/footer_two_center_right33.jpg"/></a>
						<a href=""><img src="<?php echo TEMPLATE?>/images/footer_two_center_right32.png"/></a>
						<a href=""><img src="<?php echo TEMPLATE?>/images/footer_two_center_right31.png"/></a>
					</div>				
			</div>
		</div>
	</div>
	<!--footer区域结束-->
	<div id="goTop"></div>
		
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
</body>
</html>
